﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<ali:Get ID="Menu" Object="Menu" InnerID="Request.QueryString['ID']" Validate="True" />
<script language="c#" runat="server">
protected string CurrentCategoryID
{
	get
	{
		if (!String.IsNullOrEmpty(Request.QueryString["CategoryID"]))
			return Request.QueryString["CategoryID"];
		else if (Request.Cookies["CategoryID"] != null)
			return Request.Cookies["CategoryID"].Value;
		else
			return null;
	}
}
</script>
<section data-page="menu_edit" data-title="编辑菜单" data-lang="<%=ContentLang%>" data-id="<%=Request.QueryString["ID"]%>" data-guid="<%=Menu[ID]%>" data-style="<%=HttpUtility.HtmlEncode(Convert.ToString(Menu[Style]))%>" data-type="<%=Menu[Type]%>" data-Parent-id="<%=Menu[ParentID]%>">
	<dl class="path1">
		<dt><span>您的位置：</span><a href="list.aspx?Lang=<%=ContentLang%>" target="ali-navtab">菜单列表</a> → <b class="<%=ContentLang%>Font"><%=Menu[Name]%></b></dt>
		<dd>
			<select data-class="<%=ContentLang%>Font" data-ali-widget="combo">
				<ali:List Object="Language" Source="Manager.Languages">
					<ali:Record>
						<%If Convert.ToString(Ab) == ContentLang%>
							<option value="<%=Ab%>" selected><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%Else%>
							<option value="<%=Ab%>"><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%EndIf%>
					</ali:Record>
				</ali:List>
			</select>
		</dd>
	</dl>
	<form action="" class="post">
		<div class="post-body">
			<table class="post-table margin2">
				<tr>
					<th>名称：</th>
					<td>
						<input type="text" name="Name" value="<%=Menu[Name]%>" size="60" maxlength="255" class="ali-input ali-input-required <%=ContentLang%>Font">
						<label><input type="checkbox" data-name="Bold">粗体</label>
						<label><input type="checkbox" data-name="Italic">斜体</label>
						颜色：<button type="button" data-name="Color" size="8" class="color-selector"></button>
						<label><input type="checkbox" data-name="Custom">自定</label>
						<br>
						<input type="text" data-name="CustomStyle" size="60" style="display:none" class="ali-input">
						<label><input type="checkbox" data-operation="CheckGuid">Guid：</label><input type="text" name="ID" value="<%=Menu[ID]%>" size="40" maxlength="40" disabled class="ali-input ali-disabled">
					</td>
				</tr>
				<tr>
					<th>类别：</th>
					<td>
						<select name="CategoryID" data-class="<%=ContentLang%>Font" data-tree="true" data-root="" data-ali-widget="combo">
							<option data-item="" data-parent="" value="">公共菜单</option>
							<ali:Tree Object="MenuCategory">
								<ali:Record>
									<%If Convert.ToString(ID) == CurrentCategoryID%>
										<option data-item="<%=InnerID%>" data-parent="<%=ParentInnerID%>"  value="<%=ID%>" selected><%=Name%></option>
									<%Else%>
										<option data-item="<%=InnerID%>" data-parent="<%=ParentInnerID%>"  value="<%=ID%>"><%=Name%></option>
									<%EndIf%>
									<%=ChildRecords%>
								</ali:Record>
							</ali:Tree>		
						</select>
					</td>
				</tr>
				<tr>
					<th>父菜单：</th>
					<td>
						<select name="ParentID" data-class="<%=ContentLang%>Font" data-tree="true" data-root="" data-ali-widget="combo">
							<option data-item="" data-parent="" value="">未指定</option>
							<ali:Tree Object="Menu" Condition="CategoryID=CurrentCategoryID ">
								<ali:Record>
									<%If Guid.Equals(ID, Menu[ParentID])%>
										<option data-item="<%=InnerID%>" data-parent="<%=ParentInnerID%>" value="<%=ID%>" selected><%=Name%></option>
									<%Else%>
										<option data-item="<%=InnerID%>" data-parent="<%=ParentInnerID%>" value="<%=ID%>"><%=Name%></option>
									<%EndIf%>		
									<%=ChildRecords%>
								</ali:Record>
							</ali:Tree>		
						</select>
					</td>
				</tr>
				<tr>
					<th>链接地址：</th>
					<td>
						<%If Convert.ToString(Menu[LinkType]) == 'Content'%>
							<label><input type="radio" name="LinkType" value="Content" class="ali-input" checked>内容</label>
							<label><input type="radio" name="LinkType" value="InnerLink" class="ali-input">站内链接</label>
							<label><input type="radio" name="LinkType" value="OuterLink" class="ali-input">站外链接</label>
						<%ElseIf Convert.ToString(Menu[LinkType]) == 'InnerLink'%>
							<label><input type="radio" name="LinkType" value="Content" class="ali-input">内容</label>
							<label><input type="radio" name="LinkType" value="InnerLink" class="ali-input" checked>站内链接</label>
							<label><input type="radio" name="LinkType" value="OuterLink" class="ali-input">站外链接</label>
						<%ElseIf Convert.ToString(Menu[LinkType]) == 'OuterLink'%>
							<label><input type="radio" name="LinkType" value="Content" class="ali-input">内容</label>
							<label><input type="radio" name="LinkType" value="InnerLink" class="ali-input">站内链接</label>
							<label><input type="radio" name="LinkType" value="OuterLink" class="ali-input" checked>站外链接</label>
						<%EndIf%>
						<br />
						<span name="ChannelIDSpan" style="display:none">
							栏目：
							<select name="ChannelID" data-class="<%=ContentLang%>Font" data-tree="true" data-root="" data-ali-widget="combo">
								<ali:Tree Object="Channel">
									<ali:Record>
										<%If Guid.Equals(ID, Menu[ChannelID])%>
											<option data-item="<%=InnerID%>" data-parent="<%=ParentInnerID%>" value="<%=ID%>" selected><%=Name%></option>
										<%Else%>
											<option data-item="<%=InnerID%>" data-parent="<%=ParentInnerID%>" value="<%=ID%>"><%=Name%></option>
										<%EndIf%>
										<%=ChildRecords%>
									</ali:Record>
								</ali:Tree>		
							</select>
						</span>
						<input type="text" name="Path" value="<%=Menu[Path]%>" size="35" maxlength="255" class="ali-input" style="display:none"><span name="PathTip" style="display:none">如果扩展名.ext，则表示与栏目设置一致</span>
						<div data-name="Page" style="display:none"><br>
							自定模板：<input type="text" name="PageTemplate" value="<%=Menu[PageTemplate]%>" class="ali-input">可以空<br>
							页面标识：<input type="text" data-name="PageID" value="<%=Menu[PageID]%>" class="ali-input">
									<select data-name="PageIDCandidate" data-ali-widget="combo">
										<option>预定义</option>
										<option value="{ID}">ID</option>
										<option value="{Guid}">Guid</option>
									</select>可以空<br />
						</div>
					</td>
				</tr>
				<tr>
					<th>目标窗口：</th>
					<td>
						<select name="Target" data-ali-widget="combo">
							<option value="_self">在原窗口打开(_self)</option>
							<option value="_top">在顶层窗口打开(_top)</option>
							<option value="_parent">在父窗口打开(_parent)</option>
							<option value="_blank">在新窗口打开(_blank)</option>
						</select>
					</td>
				</tr>
				<tr>
					<th>是否显示：</th>
					<td>
						<%If Convert.ToBoolean(Menu[IsDisplay])%>
							<label><input type="radio" name="IsDisplay" value="true" checked>是</label>
							<label><input type="radio" name="IsDisplay" value="false">否</label>
						<%Else%>
							<label><input type="radio" name="IsDisplay" value="true">是</label>
							<label><input type="radio" name="IsDisplay" value="false" checked>否</label>
						<%EndIf%>
					</td>
				</tr>
				<tr>
					<th>类型：</th>
					<td>
						<select name="Type" data-ali-widget="combo">
							<option value="Text">文本</option>
							<option value="Picture">图片</option>
							<option value="Audio">音频</option>
							<option value="Video">视频</option>
							<option value="Flash">Flash</option>
							<option value="File">文件</option>
						</select>
					</td>
				</tr>
				<tr data-name="ThumbnailRow" style="display:none">
					<th>缩略图：</th>
					<td><input type="text" name="Thumbnail" value="<%=Menu[Thumbnail]%>" size="60" class="ali-input"><a class="ali-button ali-uploader">浏览...</a><a data-operation="SelectThumbnail" class="ali-button">选择</a></td>
				</tr>
				<tr data-name="FileRow" style="display:none">
					<th>文件：</th>
					<td>
						<input type="text" name="File" value="<%=Menu[File]%>" size="60" class="ali-input">
						<select name="PlayerID" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
							<option value="">-- 智能播放器 --</option>
							<optgroup label="操作">
								<option value="parse1">普通分析</option>
								<option value="parse2">高级分析</option>
							</optgroup>
							<optgroup label="播放器">
								<ali:List Object="Player">
									<ali:Record>
										<%If Guid.Equals(ID, Menu[PlayerID])%>
											<option value="<%=ID%>" selected><%=Name%></option>
										<%Else%>
											<option value="<%=ID%>"><%=Name%></option>
										<%EndIf%>
									</ali:Record>
								</ali:List>
							</optgroup>
						</select>
						<a class="ali-button ali-uploader">浏览...</a>
					</td>
				</tr>
				<tr data-name="HtmlEditorTR">
					<th>内容：</th>
					<td>
						<textarea name="Content" data-instance="<%=InstanceID%>" class="editor"><%=HttpUtility.HtmlEncode(Menu[Content].ToString())%></textarea>
					</td>
				</tr>
				<tr>
					<th>样式类名：</th>
					<td>
						<input type="text" name="Class" value="<%=Menu[Class]%>" size="20" maxlength="20" class="ali-input">
					</td>
				</tr>
				<tr>
					<th>指标：</th>
					<td>
						人气：<input type="text" name="HitCount" value="<%=Menu[HitCount]%>" size="10" maxlength="255" class="ali-input">
						下载：<input type="text" name="DownCount" value="<%=Menu[DownCount]%>" size="10" maxlength="255" class="ali-input">
					</td>
				</tr>
			</table>
		</div>
		<div class="post-footer"><button type="submit" class="ali-button">保 存</button><input type="hidden" name="PictureAllowedType" value="gif|jpg|jpeg|png|bmp|png"></div>
	</form>
</section>